<template>
	<view class="list" >
		<view class="fixbg" :style="{'background-image':`url(${songs.coverImgUrl})`}">
			
		</view>
		<hand title='歌单' :icon='true' color='white'></hand>
		
		<view class="container" v-show="!isloading">
			<scroll-view scroll-y="true" >
				<view class="list-head">
					<view class="list-head-img">
						<image :src="songs.coverImgUrl" mode=""></image>
						<text class="iconfont icon-yousanjiao">{{songs.playCount | formaCount}}</text>
					</view>
					<view class="list-head-text">
						<view >{{songs.name
}}</view>
						<view >
							<image :src="songs.creator.avatarUrl" mode=""></image>{{songs.creator.nickname}}
						</view>
						<view >{{songs.description
}}</view>
						
					</view>
					
				</view>
				<!-- #ifdef MP-WEIXIN -->
				<button class="list-share" open-type="share">
					<text class="iconfont icon-fenxiang"></text>分享给好友
				</button>
				<!-- #endif -->
				<view class="list-music">
					<view class="list-music-head">
						<text class="iconfont icon-bofang"></text>
						<text>全部播放</text>
						<text>(共{{songs.trackCount
}}首)</text>
					</view>
					<view class="list-music-item" v-for="(item,index) in songs.tracks" :key="index" @tap='handleToDetall(item.id)'>
						<view class="list-music-top">{{index+1}}</view>
						<view class="list-music-song">
							<view class="text">{{item.name}}</view>
							<view >
								<!-- <view class="imgs sq" v-if="privileges[index].flag>60&&privileges[index].flag<70"></view> -->
								<view class="imgs sq" v-if="privileges[index].maxbr==999000"></view>
								<view class=" text" style="flex: 1;">{{item.ar[0].name}} - {{item.name}}</view>
								
							</view>
						
						
						</view>
							<text class="iconfont icon-24gl-playCircle"></text>
					</view>
					
				</view>
			</scroll-view>
			
		</view>
	</view>
</template>

<script>
	import '@/common/iconfont.css'
	import hand from "../../components/miuschead/miuschead.vue"
	import { apis } from "../../common/api.js"
	export default {
		data() {
			return {
				songs:{
					coverImgUrl:'',
					creator:{
						avatarUrl:'',
					},
					trackCount:''
					
				}, //数据
				privileges:[],
				isloading:true

				

			}
		},
		onLoad(options) {
			console.log(options.listId);
			uni.showLoading({
				title:'加载中...'
			})
			apis.list(options.listId).then((res)=>{
				if(res[1].data.code=='200'){
					console.log(res[1].data);
this.songs=res[1].data.playlist
this.privileges=res[1].data.privileges
this.$store.commit('INIT_TOPLISTIDS',res[1].data.playlist.trackIds)
this.isloading=false
uni.hideLoading()


				}
			})
		},
		components:{
			hand
		},
		methods: {
			handleToDetall(id){
				uni.navigateTo({
					url:'/pages/detall/detall?songid='+id
				})
			}
		}
	}
</script>

<style scoped>
	.list{
		
	}
	.list-head{
		display: flex;
		margin: 30rpx;
	}
	.list-head-img{
		width: 264rpx;
		height: 264rpx;
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
		margin-right: 42rpx;
	}
	.list-head-img image{
		width: 100%;
		height: 100%;
	}
	.list-head-img text{
		position: absolute;
		top: 8rpx;
		right: 8rpx;
		color: white;
		font-size: 26rpx;
	}
	.list-head-text{
		flex: 1;
		color: #f0f2f7;
	}
	.list-head-text view:nth-child(1){
		color: white;
		font-size: 34rpx;
	}
	.list-head-text view:nth-child(2){
		display: flex;
		margin: 20rpx 0;
		font-size: 24rpx;
		align-items: center;
	}
	.list-head-text view:nth-child(2) image{
		width: 54rpx;
		height: 54rpx;
		border-radius: 50%;
		margin-right: 14rpx;
	}
	.list-head-text view:nth-child(3){
		line-height: 34rpx;
		font-size: 22rpx;
	}
.list-share{
	width: 330rpx;
	height: 74rpx;
	margin: 0 auto;
	background-color:rgba(0,0,0,0.3) ;
	border-radius: 37rpx;
	color: white;
	line-height: 74rpx;
	text-align: center;
	font-size: 28rpx;
}
.list-share text{
	margin-right: 16rpx;
}
.list-music{

background-color: white ;
	border-radius: 50rpx;
	margin-top:40rpx;
	overflow:hidden;
	
}
.list-music-head{
	height: 50rpx;
	margin: 30rpx 0 70rpx 22rpx;
	
} 
.list-music-head text:nth-child(1){
	height: 50rpx;
	font-size: 50rpx;
}
.list-music-head text:nth-child(2){
	font-size: 30rpx;
	margin: 0 10rpx 0 26rpx;
}
.list-music-head text:nth-child(3){
	font-size: 26rpx;
	color: #b2b2b2;
}
.list-music-item{
	display: flex;
	 margin: 0 32rpx 66rpx 46rpx;
	 align-items: center;
	 color: #959595;}
.list-music-top{width: 58rpx; font-size: 32rpx; line-height: 30rpx;}
.list-music-song{flex: 1;}
.list-music-song view:nth-child(1){font-size: 28rpx; color: #000;

width: 70vw;

}
.list-music-song view:nth-child(2){display: flex; 
font-size: 20rpx;
align-items: center;
width: 70vw;}
.list-music-song view:nth-child(2) .imgs{width: 30rpx;
height: 20rpx;
margin: right 10rpx; ;}
.list-music-item text{
	font-size: 50rpx;
	color: #c7c7c7;
}
</style>
